<template>
  <div id="signdiv">
    <img src="../assets/sign.webp"/>

    <el-form ref="form" :model="form" :rules="rules">
      <el-form-item label="邮箱">
        <el-input v-model="form.email"></el-input>
      </el-form-item>
      <el-form-item label="验证码">
        <br/>
        <el-input v-model="form.code" style="width: 55%"></el-input>
        <img src="../assets/code1.png" style="height: 50px"/>
      </el-form-item> <el-form-item label="用户名">
      <el-input v-model="form.uname"></el-input>
    </el-form-item> <el-form-item label="密码">
      <el-input v-model="form.password" type="password"></el-input>
    </el-form-item>
      <el-form-item label="请选择身份">
        <el-select v-model="value" placeholder="请选择" style="width: 294px">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-button id="signbutton" @click="handleSign">注册</el-button>
    </el-form>
  </div>
</template>
<script>

export default {
  data () {
    return {
      options: [{
        value: '1',
        label: '用户'
      }, {
        value: '2',
        label: '租户'
      }, {
        value: '3',
        label: '答者'
      }],
      value: '',
      form: {
        email: '',
        code: '',
        uname: '',
        password: ''
      },
      rules: {
        uname: [
          { required: true, message: '请输入用户名', trigger: 'change' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    handleSign(){
      this.$message.success("注册成功");
      this.$router.push("/login")
    },
    onSubmit() {
      console.log('submit!');
    }
  }
}
</script>
<style>
#signdiv form{
  position: absolute;
  right: 20px;
  top: 0px;
  display: inline-block;
  width: 300px;
  margin-left: 40px;
  padding-right: 70px;
  margin-top: 20px;
  /*border: 2px solid;*/
}
#signdiv{
  position: relative;
  width: 900px;
  height: 595px;
  margin: 100px auto;
  box-shadow:0 0 15px #373d41;
  overflow: hidden;
}
#signdiv img{
  position: absolute;
  display: inline-block;
  height: 105%;
}
#signbutton{
  margin-left: 110px;
}

</style>
